package com.tdk.common.util

import android.util.Log
import java.io.Closeable
import java.io.IOException

/**
 * The type Safe close util.
 *
 * @Des: SafeCloseUtil
 * @Author: linhui.shi
 * @Date: 2021 /2/25 16:11
 */
object SafeCloseUtil {
    /**
     * Close the closeable obj.
     *
     * @param closeable the closeable
     */
    fun close(closeable: Closeable?) {
        if (null != closeable) {
            try {
                closeable.close()
            } catch (e: IOException) {
                Log.d("SafeCloseUtil", "SafeCloseUtil close: " + e.message)
            }
        }
    }
}